Skip to content

Conversation

@ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Sep 9, 2023

Adds BlockHash to CallOpts so contract bindings can be used to call contracts at a specific block hash. Previously only block number or pending was supported.

Backwards compatibility is preserved by introducing a new BlockHashContractCaller interface with the CallContractAtHash and CodeAtHash methods required from the backend, following a similar pattern to PendingContractCaller. Simulated backend is updated to support the new methods and CodeAtHash has been added to ethclient.Client - it already supported CallContractAtHash.

Fixes #28017

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ajsutton
Copy link
Contributor Author

@MariusVanDerWijden Mind hitting merge for me? :)

@karalabe
Copy link
Member

We've discussed this last week. Should be ok, but it creates a strange asymmetric API. Would be nice to add the "AtHash" methods for everything (code, balance, nonce, etc).

@ajsutton
Copy link
Contributor Author

We've discussed this last week. Should be ok, but it creates a strange asymmetric API. Would be nice to add the "AtHash" methods for everything (code, balance, nonce, etc).

@karalabe Added BalanceAtHash, NonceAtHash and StorageAtHash to complete the set.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM!

@holiman holiman added this to the 1.13.5 milestone Oct 17, 2023
@karalabe karalabe merged commit b85c860 into ethereum:master Oct 17, 2023
@ajsutton ajsutton deleted the aj/binding-hash branch October 19, 2023 00:12
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
…ific block hash (ethereum#28084)

* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
Dergarcon pushed a commit to MetaMask/mev-geth-0x2mev that referenced this pull request Jan 31, 2024
…ific block hash (ethereum#28084)

* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
AnnaShaleva added a commit to bane-labs/go-ethereum that referenced this pull request Feb 7, 2024
…71c907d1dc6504ed32a9161e71351

Merge Geth master updates starting from 766272f
ending by 16ce7bf.

The list of PRs that are important for us:
- ethereum/go-ethereum#28147 removal of rollback mechanism in downloader. We may still need this mechanism since we're pre-merge and allow forks;
- ethereum/go-ethereum@3dc45a3 related to release pipeline, example of pre-release version update;
- ethereum/go-ethereum@dc34fe8 related to release pipeline, example of post-release version update;
- ethereum/go-ethereum#28098 BLOBBASEFEE opcode implemented as a part of Cancun (we have to support it eventually);
- ethereum/go-ethereum#28195 introduce new Cancun-related block fields to eth tools;
- ethereum/go-ethereum#28243 introduce blob transactions support for internal eth services;
- ethereum/go-ethereum#28084 allows to invoke contract at specific block hash, may be useful for Governance contract integration;
- ethereum/go-ethereum#28538 Dockerfile.alltools update example, just to remember that it should be in sync with Dockerfile;
- ethereum/go-ethereum#28605 Improved Cancun- and Shanghai- related consensus verification. Although we must enable Shanghai and Cancun in dBFT, this PR is a hint of what should be changed wrt Clique/Ethash implementation for this;
- ethereum/go-ethereum#28549 GitHub actions are added for tests;
- ethereum/go-ethereum#27766 Beacon Committee chain implementation (light chain that is able to verify signed blocks once synced);

Signed-off-by: Anna Shaleva <[email protected]>
AnnaShaleva added a commit to bane-labs/go-ethereum that referenced this pull request Feb 8, 2024
…1dc6504ed32a9161e71351

Merge Geth master updates starting from 766272f
ending by 99dc3fe (v1.13.11 stable release).

The list of PRs that are important for us:
    - ethereum/go-ethereum#28147 removal of rollback mechanism in downloader. We may still need this mechanism since we're pre-merge and allow forks;
    - ethereum/go-ethereum@3dc45a3 related to release pipeline, example of pre-release version update;
    - ethereum/go-ethereum@dc34fe8 related to release pipeline, example of post-release version update;
    - ethereum/go-ethereum#28098 BLOBBASEFEE opcode implemented as a part of Cancun (we have to support it eventually);
    - ethereum/go-ethereum#28195 introduce new Cancun-related block fields to eth tools;
    - ethereum/go-ethereum#28243 introduce blob transactions support for internal eth services;
    - ethereum/go-ethereum#28084 allows to invoke contract at specific block hash, may be useful for Governance contract integration;
    - ethereum/go-ethereum#28538 Dockerfile.alltools update example, just to remember that it should be in sync with Dockerfile;
    - ethereum/go-ethereum#28605 Improved Cancun- and Shanghai- related consensus verification. Although we must enable Shanghai and Cancun in dBFT, this PR is a hint of what should be changed wrt Clique/Ethash implementation for this;
    - ethereum/go-ethereum#28549 GitHub actions are added for tests;
    - ethereum/go-ethereum#27766 Beacon Committee chain implementation (light chain that is able to verify signed blocks once synced);

Signed-off-by: Anna Shaleva <[email protected]>
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 24, 2025
…ific block hash (ethereum#28084)

* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Aug 26, 2025
gzliudan added a commit to XinFinOrg/XDPoSChain that referenced this pull request Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support BlockHash in contract bindings

4 participants